import java.io.IOException;
import java.util.HashMap;

public class UdpDictServer extends UdpEchoServer {
    private HashMap<String,String> dict=new HashMap<>();

    public UdpDictServer(int port) throws IOException {
        super(port);

        dict.put("cat","小猫");
        dict.put("pig","小猪");
        dict.put("snake","小蛇");
        dict.put("dog","小狗");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"字典暂未收录");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer=new UdpDictServer(9090);
        udpDictServer.start();
    }

}
